﻿using System;
using System.Windows;
using Notifications.Wpf;

namespace YZAutoDWR.Handler;

public static class Utils
{
    private static readonly NotificationManager Manager = new();

    public static void ShowToast(this object _, string title, string message = "",
        NotificationType type = NotificationType.Information, double expirationTime = 3)
    {
        Application.Current?.Dispatcher.Invoke(() =>
        {
            Manager.Show(new NotificationContent
            {
                Title = title,
                Message = message,
                Type = type
            }, expirationTime: TimeSpan.FromSeconds(expirationTime));
        });
    }
}